﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package GameMode {
    import flash.events.*;
    import Classes.*;
    import Display.*;

    public class GMPlant extends GMEdit {

        public var m_contractType:String;
        public var m_contractClass:String;

        public function GMPlant(_arg1:String){
            this.m_contractType = _arg1;
            this.m_contractClass = "";
            var _local2:Item = Global.gameSettings.getItemByName(_arg1);
            if (_local2){
                this.m_contractClass = _local2.type;
            };
            super();
        }
        override public function enableMode():void{
            super.enableMode();
            UI.popupLock();
            var _local1:String = this.m_contractType.split("_")[1];
            switch (_local1){
                case "test":
                    m_cursorImage = EmbeddedArt.hud_act_corn;
                    break;
                case "strawberries":
                    m_cursorImage = EmbeddedArt.hud_act_straw;
                    break;
                case "eggplants":
                    m_cursorImage = EmbeddedArt.hud_act_eggplant;
                    break;
                case "carrots":
                    m_cursorImage = EmbeddedArt.hud_act_carrot;
                    break;
                case "corn":
                    m_cursorImage = EmbeddedArt.hud_act_corn;
                    break;
                case "watermelon":
                    m_cursorImage = EmbeddedArt.hud_act_watermelon;
                    break;
                case "pumpkin":
                    m_cursorImage = EmbeddedArt.hud_act_pumpkin;
                    break;
                case "wheat":
                    m_cursorImage = EmbeddedArt.hud_act_wheat;
                    break;
                case "peas":
                    m_cursorImage = EmbeddedArt.hud_act_pea;
                    break;
                case "cranberries":
                    m_cursorImage = EmbeddedArt.hud_act_cran;
                    break;
                case "rosesyellow":
                    m_cursorImage = EmbeddedArt.hud_act_yellowrose;
                    break;
                case "rosespink":
                    m_cursorImage = EmbeddedArt.hud_act_pinkrose;
                    break;
                case "roses":
                    m_cursorImage = EmbeddedArt.hud_act_redrose;
                    break;
                case "clover":
                    m_cursorImage = EmbeddedArt.hud_act_clover;
                    break;
                case "cabbage":
                    m_cursorImage = EmbeddedArt.hud_act_cabbage;
                    break;
                case "sweetpotato":
                    m_cursorImage = EmbeddedArt.hud_act_sweetpotato;
                    break;
                case "lettuce":
                    m_cursorImage = EmbeddedArt.hud_act_lettuce;
                    break;
                case "tomatoes":
                    m_cursorImage = EmbeddedArt.hud_act_tomato;
                    break;
                case "alfalfa":
                    m_cursorImage = EmbeddedArt.hud_act_alfalfa;
                    break;
                case "blueberries":
                    m_cursorImage = EmbeddedArt.hud_act_blueberries;
                    break;
                case "artichoke":
                    m_cursorImage = EmbeddedArt.hud_act_artichoke;
                    break;
                default:
                    if (this.m_contractClass == "ship_contract"){
                        m_cursorImage = EmbeddedArt.hud_biz_supply;
                    };
            };
        }
        override public function disableMode():void{
            super.disableMode();
            UI.popupUnlock();
        }
        override protected function isObjectSelectable(_arg1:GameObject):Boolean{
            var _local2:HarvestableResource = (_arg1 as HarvestableResource);
            return (((_local2) && (_local2.isPlantable(this.m_contractType))));
        }
        override protected function selectObject(_arg1:GameObject, _arg2:MouseEvent=null):void{
            super.selectObject(_arg1, _arg2);
            var _local3:HarvestableResource = (_arg1 as HarvestableResource);
            if (_local3){
                _local3.plant(this.m_contractType);
            };
        }
        override protected function handleClick(_arg1:MouseEvent):void{
            if (m_highlightedObject){
                super.handleClick(_arg1);
            } else {
                Global.world.addGameMode(new GMPlay());
            };
        }

    }
}//package GameMode 
